var ubigeos = {
		init:function(){
			$('#ubigeos').jqGrid({
	           url:'ubigeos/index',
	           datatype:'json',
	           mtype:'POST',
	           colNames:['id','Ubigeo','Distrito','Provincia','Departamento','Estado'],
	           colModel:[
	               {name:"data[Ubigeo][id]",hidden:true},
	               {name:"data[Ubigeo][ubigeo]",align:"right" ,index:'Ubigeo.ubigeo',width:50,align:'left',sortable:true,editable:true,editoptions:{maxlength:5},editrules:{required:true},searchoptions:{sopt:['cn','eq','ne','lt','le','gt','ge','bw','ew']}},
				   {name:"data[Ubigeo][distrito]",index:'Ubigeo.distrito',width:250,align:'left',sortable:true,editable:true,editoptions:{maxlength:20, size:25},editrules:{required:true},searchoptions:{sopt:['cn','eq','ne','lt','le','gt','ge','bw','ew']}},
				   {name:"data[Ubigeo][provincia]",index:'Ubigeo.provincia',width:250,align:'left',sortable:true,editable:true,editoptions:{maxlength:20, size:25},editrules:{required:true},searchoptions:{sopt:['cn','eq','ne','lt','le','gt','ge','bw','ew']}},
				   {name:"data[Ubigeo][departamento]",index:'Ubigeo.departamento',width:250,align:'left',sortable:true,editable:true,editoptions:{maxlength:20, size:25},editrules:{required:true},searchoptions:{sopt:['cn','eq','ne','lt','le','gt','ge','bw','ew']}},
				   {name:"data[Ubigeo][estado_id]",
				   		index:'Estado.descripcion',
						width:60,
						align:'left',
						editable: true,
						edittype:"select",
						editrules:{required:true},
						editoptions:{
							value:"1:Activo;2:Desactivo"
						},
						searchoptions:{
							sopt:['cn','eq','ne','lt','le','gt','ge','bw','ew']
						}
					}               
	           ],
			  
			   pager:$('#ubigeos-pager'),
	           rowNum:10,
	           rowList:[10,20,30],
	           mtype: "POST",
	           viewrecords:true,
	           caption:'Ubigeos',
	           height:'180',
	           sortname: "Ubigeo.ubigeo",
	           editurl: 'ubigeos/index'
	          
	                
	       });
	       $('#ubigeos').navGrid("#ubigeos-pager",
		   	{edit:true,add:true,del:true},
				{clearAfterEdit:false,reloadAfterSubmit:true, closeOnEscape:true},
				{clearAfterAdd:false,reloadAfterSubmit:true, closeOnEscape:true},
		   		{width:270,reloadAfterSubmit:true, closeOnEscape:true},
				{sopt:['cn','eq','ne','lt','le','gt','ge','bw','ew'],multipleSearch:true, closeOnEscape:true});
	       $("#ubigeos").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false});
	       jQuery("#ubigeos").jqGrid('setGridWidth',$('#RightPane').width()-50);
		}
};